package com.aretias.jkholdings.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.aretias.jkholdings.model.Product;
import com.aretias.jkholdings.model.ProductParam;
import com.aretias.jkholdings.repository.ProductRepository;

@Service
public class ProductServiceImpl implements ProductService {
	
	@Autowired
	private ProductRepository productRepository;
	
	@Override
	public int addProduct(ProductParam param) {
		return productRepository.insertProduct(param);
	}

	@Override
	public int modifyProduct(ProductParam param) {
		return productRepository.updateProduct(param);
	}

	@Override
	public List<Product> getProductsList(ProductParam param) {
		return productRepository.selectProductsList(param);
	}
	
	@Override
	public int getProductsListCount(ProductParam param) {
		return productRepository.selectProductsListCount(param);
	}
	
	@Override
	public Product getProduct(ProductParam param) {
		return productRepository.selectProduct(param);
	}

	@Override
	public void removeProduct(ProductParam param) {
		productRepository.deleteProduct(param);		
	}

}
